﻿@using KMF.Common
@model ProductCateTempMappingDto
<div class="box-Info" style="display: none;">
    <div class="Info-header">
        <span>Template</span>
    </div>
    <div class="Info-body cate-temlate-list">
        <table class="table-odd table-plist table-cate-template">
            <colgroup>
                <col style="width: 30px" />
                <col />
                <col />
                <col style="width: 150px" />
                <col style="width: 60px" />
            </colgroup>
            <tr>
                <th scope="col">Mã</th>
                <th scope="col">Mô tả template</th>
                <th scope="col">Mô tả</th>
                <th scope="col">Trên trang chủ</th>
                <th scope="col"></th>
            </tr>
            @foreach (var item in (List<ViewProductCateTempMappingDto>)ViewBag.CateTemplateList)
            {
                <tr class="@string.Format("ct-{0}", item.Id)">
                    <td>
                        @item.Id
                    </td>
                    <td>
                        @item.TempDescription
                    </td>
                    <td>
                        @item.Description
                    </td>
                    <td>
                        @Html.CheckBox("IsOnHomePage", item.IsOnHomePage)
                    </td>
                    <td>
                        @Ajax.ActionLink("EditCate", "EditCateTemplate", new { id = item.Id }, new AjaxOptions
                        {
                            OnBegin = "ShowLoading",
                            OnComplete = "HideLoading",
                            OnSuccess = "AjaxReturnDataEditCateTemplate"
                        }, new { @class = "icon-edit-v2 fl-l bootstrapTangoSmall", title = "chỉnh sửa" })

                        @Ajax.ActionLink("Xóa", "DeleteCateTemplate", "AdminProductCategory", new { id = item.Id }, new AjaxOptions
                        {
                            Confirm = "Bạn chắc chắn muốn xóa template này!",
                            OnSuccess = "AjaxReturnDataDeleteCateTemplate"
                        }, new { @class = "icon-delete fl-l bootstrapTangoSmall", title = "xóa" })

                    </td>
                </tr>
            }
        </table>
        
        <div class="banner-wrapper m-t-20">
            @using (Ajax.BeginForm("CateTemplate", new AjaxOptions
                                                                {
                                                                    OnBegin = "ShowLoading",
                                                                    OnComplete = "HideLoading",
                                                                    OnSuccess = "AjaxResultDataAddCateTemplate"
                                                                }))
            {
                @Html.Hidden("ProductCateId",  (string)ViewBag.CateId )
                <table class="table-info create-banner-image">
                    <tr>
                        <td class="tInfoLeft">
                            Template
                        </td>
                        <td class="tInfoRight">
                            @Html.DropDownListFor(m => m.TemplateId, new SelectList((List<TemplateDto>)ViewBag.TemplateList, "Id", "Description"))
                        </td>
                    </tr>
                    <tr>
                        <td class="tInfoLeft">
                            Mô tả
                        </td>
                        <td class="tInfoRight">
                            @Html.TextAreaFor(m => m.Description)
                        </td>
                    </tr>
                    <tr>
                        <td class="tInfoLeft">
                            Xuất hiện trên trang chủ
                        </td>
                        <td class="tInfoRight">
                            @Html.CheckBoxFor(m => m.IsOnHomePage)
                        </td>
                    </tr>
                    <tr>
                        <td class="tInfoLeft">
                        </td>
                        <td class="tInfoRight">
                            <input type="submit" value="Tạo template"/>                 
                        </td>
                    </tr>
                </table>
            }
        </div>
    </div>
</div>